package kr.hkit.framework.inputPanel;

import javax.swing.JPanel;

import java.awt.GridLayout;
import java.awt.LayoutManager;

import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.SwingConstants;

public class inputCmbPanel extends JPanel {
	private JLabel lblTitle;
	private JComboBox<String> comboBox;
	
	public inputCmbPanel() {
		initialize();
	}
		
	public inputCmbPanel(String title) {
		initialize();
		lblTitle.setText(title);
	}

	public void setLblTitle(String title){
		lblTitle.setText(title);
	}
	
	public void setComboItems(String...item){
		for(String str : item){
			comboBox.addItem(str);
		}
	}
	
	public String getSelectedItem(){
		return (String) comboBox.getSelectedItem();
	}
	
	private void initialize(){
		setLayout(new GridLayout(0, 2, 0, 0));
		
		lblTitle = new JLabel();
		lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblTitle);
		
		comboBox = new JComboBox<>();
		add(comboBox);
	}

}
